import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
 
// 用来存储数据
const state = {
    userdata: {
        userIndex:'',
        userId:'',
        userName: '',
        userClass:'',
        roleName: '',
        roleId:''
        
    },
    isCollapse: false
}
// 响应组件中的事件
const actions = {
    
}
// 操作数据
const mutations = {
    MENUHANDLER(state) {
        state.isCollapse = !state.isCollapse;
    },
    SET_USER(state, userdata) {
        state.userdata = userdata;
        console.log(state.userdata);
    }
}
// 用来将state数据进行加工
const getters = {
 
}
// 新建并暴露store
export default new Vuex.Store({
    namespaced: true,
    state,
    actions,
    mutations,
    getters
})
 